home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 6 / The Arsenal Files 6 (Arsenal Computer).ISO / os2bbs / va1b1-o2.zip / SCRIPT.DOC < prev    next >
Text File  |  1996-01-28  |  14KB  |  455 lines

  1.          
  2.          SCRIPT.DOC - Using This Document
  3.          ══════════
  4.  
  5.                 Throughout this document, script code fragments (examples)
  6.          are preceeded by the characters ">>", with especially important
  7.          lines denoted by "* >>".
  8.        
  9.          SCRIPT FILES
  10.          ════════════
  11.        
  12.                 Scripts are one of the many ways in which you can modify
  13.          or customize the look, feel, and functionality of your BBS.
  14.          Script files are simple ASCII text files.  They must have a
  15.          .V filename extension, and they reside in the Script Directory,
  16.          usually C:\VADV\V, although this will differ if you installed
  17.          to a different drive and/or directory.  Script files do NOT require
  18.          compilation.
  19.  
  20.                 It is recommended that you use a plain text editor to create
  21.          and modify scripts, such as MS-DOS EDIT or similar.  If you wish
  22.          to use something fancier, such as Word for Windows, make sure
  23.          you save your script file in Text Format.  (Other word processors
  24.          may refer to this as ASCII or Plain Text format.)
  25.          
  26.          BASIC SYNTAX
  27.          ════════════
  28.        
  29.                 A script file is basically just lines of text.  A line may
  30.          be blank, or contain a comment, a label, or a command with
  31.          accompanying keywords and/or arguments.  Here is an example
  32.          showing a blank line:
  33.          
  34.      >>  cls
  35.    * >>
  36.      >>  ? "Hello World!"
  37.  
  38.          The "'" character at the start of a line denotes a comment.
  39.          Here is an example showing a comment:
  40.  
  41.      >>  cls
  42.    * >>  'Now This is a comment
  43.      >>  ? "Hello World!"
  44.  
  45.          The ":" character denotes a label.  Note the placement of
  46.          the ":" at the END of the label.  Here is an example showing
  47.          a label:
  48.        
  49.      >>  cls
  50.      >>  gosub printmsg
  51.      >>  exit
  52.      >>
  53.    * >>  printmsg:
  54.      >>  ? "Hello World!"
  55.      >>  return
  56.          
  57.          Notice that the ":" is left off when the label is actually
  58.          used in a GOTO or GOSUB command.
  59.  
  60.          SIMPLE VARIABLES
  61.          ════════════════
  62.        
  63.                 260 simple variables are available for use by your script.
  64.          Variables names are limited up to two characters; the first character
  65.          must be a character from "A" to "Z", and the second character must 
  66.          be a digit from "0" to "9".  (That means you have variables
  67.          A0 to A9, B0 to B9, and so on up to Z0 to Z9.)
  68.  
  69.          Note that if you use a single-character variable name, as in:
  70.  
  71.      >>  let a = 10
  72.  
  73.          Thats the same as writing:
  74.    
  75.      >>  let a0 = 10
  76.  
  77.          GLOBAL ARRAY VARIABLE
  78.          ═════════════════════
  79.  
  80.                 You have one global array to use.  It has slots 0 to 255.
  81.          You indicate that you want to access the global array by using
  82.          the "$" character.  You may access a slot by using a number or 
  83.          a variable.  This is an example using a number:
  84.        
  85.      >>  print $12
  86.       
  87.          It prints out the contents of whatever was in slot 12.  This
  88.          is an example using a simple variable:
  89.  
  90.      >>  let y1 = 10
  91.      >>  print $y1
  92.  
  93.          This is an example showing how to clear out the global array
  94.          using a DO-LOOP structure:
  95.  
  96.      >>  do i,1,100
  97.      >>   let $i = ""
  98.      >>  loop
  99.  
  100.          SPECIAL VALUES
  101.          ══════════════       
  102.                 
  103.                 The "!" character indicates access to the special values,
  104.          and works similarly to the global array variable.  Here are two 
  105.          examples that both do the exact same thing:
  106.        
  107.      >>  print !12 
  108.    
  109.      >>  let z = 12
  110.      >>  print !z
  111.  
  112.          !12 happens to be the current channel number.
  113.        
  114.          The special values are divided into groups based on their
  115.          function.  Those groups are a) Functionals, b) System, c) Color,
  116.          d) User Record, and e) Database.
  117.        
  118.          a) Functionals
  119.          --------------
  120.            
  121.                 Functionals take values from the simple vairables x, y, and
  122.          z, as shown below.  You must use the LET command to set the x 
  123.          (and sometimes y and z) variable(s) before trying to use the 
  124.          function.  While the example show here primary use the PRINT
  125.          command to illustrate usage, it is important note that you
  126.          can freely use functions in string and numeric expressions.
  127.        
  128.          0  chr(x)  -  Character Function
  129.  
  130.      >>  let x=65
  131.      >>  print !0
  132.  
  133.          The above example would print the character "A", since "A"
  134.          is the character represented by the ASCII code 65.  Valid
  135.          values for x the standard ASCII codes, 0 to 255.
  136.        
  137.          1  asc(x)  -  ASCII Code Function
  138.  
  139.      >>  let x="A"
  140.      >>  print !1
  141.  
  142.          The above example would print the number 65, since 65
  143.          is the ASCII code for the character "A". 
  144.        
  145.          2  sqr(x)  -  Square Root Function
  146.  
  147.      >>  let x=4 
  148.      >>  print !2
  149.        
  150.          The above example would print the result 2, since 2 is the square
  151.          root of 4.
  152.    
  153.          3  int(x)  -  Integer Function
  154.  
  155.      >>  let x=5.5
  156.      >>  print !3
  157.        
  158.          The above example would print the result 5, chopping off
  159.          the fractional part of the number.
  160.  
  161.          4  abs(x)  -  Absolute Value Function
  162.  
  163.      >>  let x=-4
  164.      >>  print !4
  165.        
  166.          The above example would print the result 4.
  167.  
  168.          5  ucase(x)  -  Upper Case Function
  169.    
  170.      >>  let x="Hello World!"
  171.      >>  print !5
  172.        
  173.          The above example would print the string "HELLO WORLD!".
  174.    
  175.          6  rnd(x)
  176.    
  177.      >>  let x=1
  178.      >>  print !6
  179.        
  180.          The above example would print a random floating-point number 
  181.          from 0 to 1.  To generate a random number between 1 and some
  182.          given limit, for example 100, use some arithmetic:
  183.  
  184.      >>  let x=1                  
  185.      >>  let x=!6*100        <------ get random number, multiply by 
  186.      >>  let x=!3+1          <--     100, and store result back in x.
  187.                                |
  188.                                ----- use int(x) function to truncate any
  189.                                      remaining fractional part and add 1.
  190.  
  191.          7  len(x)  -  String Length Function
  192.  
  193.      >>  let x="Hello World!"
  194.      >>  print !7
  195.  
  196.          The above example would print the result 12.
  197.        
  198.          8  instr(x,y)  -  InString Function
  199.  
  200.      >>  let x="ABCD"
  201.      >>  let y="C"
  202.      >>  print !8
  203.      
  204.          The above example would print the result 3, since the substring
  205.          "C" is in the third position of the mainstring "ABCD".  If the
  206.          substring cannot be found the result is zero.
  207.        
  208.          9  left(x,y)  -  Left String Function
  209.      
  210.      >>  let x="ROLAND DE GRAAF"
  211.      >>  let y=6
  212.      >>  print !9
  213.  
  214.          The preceeding example would print the string "ROLAND".
  215.  
  216.          10 mid(x,y,z)  -  Mid String Function
  217.  
  218.      >>  let x="ABC"
  219.      >>  let y=2              <---- set position
  220.      >>  let z=1              <---- set number of characters to retrieve
  221.      >>  print !10
  222.    
  223.          The above example would print the string "B".
  224.        
  225.          11 right(x,y)  -  Right String Function
  226.    
  227.      >>  let x="ROLAND DE GRAAF"
  228.      >>  let y=8
  229.      >>  print !11
  230.       
  231.          The preceeding example would print the string "DE GRAAF".
  232.        
  233.          b) System
  234.          ---------
  235.        
  236.          12  Channel Number
  237.          13  Carriage Return
  238.          14  Date
  239.          15  Date/Human Format
  240.          16  Time
  241.          17  Highest NetworkID #
  242.          18  NetName(x)
  243.          19  BBS Name
  244.          20  SysOp Name
  245.          21  YN<cr>
  246.          22  Global Result Code
  247.          23  Current Video Mode
  248.          24  Reserved
  249.          25  Reserved
  250.          26  Reserved
  251.          27  Reserved
  252.          28  Reserved
  253.          29  Reserved
  254.           
  255.          c) Colors
  256.          ---------
  257.        
  258.          30  Normal Color
  259.          31  Red
  260.          32  Green
  261.          33  Yellow
  262.          34  Blue
  263.          35  Magenta
  264.          36  Cyan
  265.          37  White
  266.          38  Bold
  267.          39  Base Color
  268.          40  Prompt Color
  269.          41  Input Color
  270.          42  Reserved
  271.          43  Reserved
  272.          44  Reserved
  273.          45  Reserved
  274.          46  Reserved
  275.          47  Reserved
  276.          48  Reserved
  277.          49  Reserved
  278.  
  279.          The following two examples both accomplish the same effect:
  280.  
  281.      >>  print !31, "Red", !32, "Green"
  282.  
  283.      >>  print !31 % "Red" % !32 % "Green"
  284.        
  285.          Note that "%" is the string concatenation operator.
  286.        
  287.          d) User Record
  288.          --------------
  289.            
  290.                 The user record variables let you have access to the user's
  291.          account data.  The ones marked with an asterisk "*" are also 
  292.          writable.
  293.        
  294.          50  User Number
  295.          51* User Handle
  296.          52* User Name
  297.          53* User Video Mode
  298.          54* User Security Level
  299.          55* User Time Limit
  300.          56* User Access Flags
  301.          57* User Flags
  302.          58* User Credits
  303.          59* User Expiration Date
  304.          60* User Page Size
  305.          61* User Extra #1
  306.          62* User Extra #2
  307.          63* User Extra #3
  308.          64* User Extra #4
  309.          65* User Extra #5
  310.          66* User Extra #6
  311.          67* User Extra #7
  312.          68* User Extra #8
  313.          69  User Total Mins Online
  314.          70  User Total Number of Calls
  315.          71  User Time On (Current Login)
  316.          72  User Time Left (Current Login)
  317.          73* User Video Mode
  318.          74* User # of Files Downloaded
  319.          75* User # of Kilobytes Downloaded
  320.          76* User # of Files Uploaded
  321.          77* User # of Kilobytes Uploaded
  322.          78* User # of Emails
  323.          79* User # of Posts
  324.          80* User Address
  325.          81* User City
  326.          82* User State
  327.          83* User Zip Code
  328.          84* User Phone #1
  329.          85* User Phone #2
  330.          86  User Age
  331.          87  Reserved
  332.          88  Reserved
  333.          89  Reserved
  334.  
  335.          This is an example showing how to set the security level:
  336.        
  337.      >>  let !54 = 100
  338.  
  339.          This is an example showing how to increase a user's credits by 500:
  340.  
  341.      >>  let !58 = !58 + 500
  342.        
  343.          e) Database Access
  344.          ------------------
  345.  
  346.                 The first 3 values, 90 through 92 are set by your use
  347.          of the script DBGROUP command, which selects a topic group:
  348.        
  349.          90  Current Topic Group Letter
  350.          91  Current Topic Group Description
  351.          92  Number of Databases in Group
  352.  
  353.          The values 93 through 99 are set by your use of the script
  354.          DB command, which selects a database within the current
  355.          topic group:
  356.  
  357.          93  Current Database Number
  358.          94  Current Database Description
  359.          95  Number of Entries in Database
  360.          96  Next-New-Message Read Pointer
  361.          97  Database Filename (no extension)
  362.          98  Database Attached-File Storage Path
  363.          99  Database Maximum
  364.  
  365.          The values 100 through 117 are set by your use of the script
  366.          LOAD command, which loads data one entry from the currently
  367.          selected database:
  368.  
  369.          100 Subject
  370.          101 From field, Handle or Name
  371.          102 From field, User number (0=Not Applicable)
  372.          103 From field, Network Address
  373.          104 From field, NetworkID
  374.          105 To field, Handle or Name
  375.          106 To field, User number (0=Not Applicable)
  376.          107 To field, Network Address
  377.          108 To field, NetworkID
  378.          109 Date/Time Stamp (String)
  379.          110 Count
  380.          111 Attached Filename (If Any)
  381.          112 Attached File Size (0=None)
  382.          113 Attached File/Full Path Format (If Any)
  383.          114 Offset into BIN file of text component
  384.          115 Length of BIN file text component
  385.          116 Date/Time Stamp (Numeric)
  386.          117 Flag field
  387.  
  388.          STRING LITERALS
  389.          ═══════════════
  390.  
  391.                 A string literal is just a sequence of characters, enclosed
  392.          in double quotes, such as "string literal".  Here are some examples
  393.          using string literals:
  394.  
  395.      >>  print "Hello World!"
  396.  
  397.      >>  let x="ABCD"
  398.  
  399.      >>  exit "main"
  400.  
  401.      >>  if a="Y" goto yes
  402.  
  403.          STRING EXPRESSIONS
  404.          ══════════════════
  405.          
  406.          NUMERIC EXPRESSIONS
  407.          ═══════════════════
  408.          
  409.                 The following mathematical, bitwise, and relational operators 
  410.          are available for use in numeric expressions:
  411.        
  412.          ^ Exponentiation
  413.          + Addition
  414.          - Subtraction
  415.          * Multiplication
  416.          / Floating-Point Division
  417.          \ Integer Division
  418.          # Modulo Arithemtic
  419.  
  420.          | Bitwise OR
  421.          & Bitwise AND
  422.  
  423.          >  Greater Than
  424.          >= Greater Than Or Equal
  425.          <  Less Than
  426.          <= Less Than or Equal
  427.          =  Equal
  428.          <> Not Equal
  429.        
  430.          COMMAND REFERENCE
  431.          ═════════════════
  432.          
  433.          TIPS
  434.          ════
  435.  
  436.                 You have up to 260 simple variables for use.  If you should 
  437.          run out, feel free to use slots in the global array as simple
  438.          variables (ie. $0, $1, $2, and so on).  The only limitation
  439.          is that global array slots cannot be used as the index variable
  440.          in a DO-LOOP structure.
  441.  
  442.                 Simple Variables and the Global Array Variable are NOT 
  443.          automatically cleared when a script is started, or when the LINK
  444.          command is used to branch to another script.  Therefore, you must 
  445.          explicitly use the LET command to clear or zero any variables 
  446.          which you want cleared.
  447.          
  448.      >>  let a = ""  
  449.      
  450.      >>  let b = 0
  451.  
  452.          This also means that you may pass information or data values
  453.          from one script to another.
  454.  
  455.